package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortPoint {
    public static void main(String[] args) {
        List<Point> list = new ArrayList<>();
        list.add(new Point(10,7));
        list.add(new Point(1,57));
        list.add(new Point(50,71));
        list.add(new Point(19,27));
        list.add(new Point(13,81));
        list.add(new Point(10,67));
        System.out.println(list);

        /*
        Collections.sort(list, new Comparator<Point>() {
            @Override
            public int compare(Point o1, Point o2) {
                return o1.getY()-o2.getY();
            }
        });

         */
        Collections.sort(list,(o1,o2)->o1.getY()-o2.getY());
        System.out.println(list);
    }
}
